﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GMLogging;

namespace ThouShaltNotBrick.Models
{
    public sealed class BrickTypesData
    {
        #region Properties
        private List<BrickTypeData> mBrickTypes;
        #endregion

        #region Constructors
        public BrickTypesData(List<BrickTypeData> pBrickTypes)
        {
            if (pBrickTypes == null)
            {
                Exception e = new ArgumentNullException("pBrickTypes");
                Logger.Error(e.Message);
                throw e;
            }

            mBrickTypes = pBrickTypes;
        }
        #endregion

        #region Methods
        public List<BrickTypeData> GetBrickTypes()
        {
            return new List<BrickTypeData>(mBrickTypes);
        }

        public BrickTypeData GetBrickType(string pBrickTypeName)
        {
            return mBrickTypes.FirstOrDefault(btd => btd.Name == pBrickTypeName);
        }
        #endregion
    }
}